<template>
    <div>
        <div class="alert-box" :class="isShow ? 'active' : ''">你好，这是提示</div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            isShow:false,
        }
    },
    mounted() {
        setTimeout(()=>{
            this.isShow = true
        },100)
        setTimeout(()=>{
            this.isShow = false
        },3000)
    },
    methods: {
        
    },
}
</script>

<style scoped lang="less">
.alert-box{
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background-color: red;
    color: white;
    padding: 10px 80px;
    border-radius: 10px;
    font-size: 18px;
    transition: all 1s ease-in-out;
    opacity: 0;
}
.active{
    opacity: 1;

}
</style>